﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.ComponentModel;
namespace OtherDevice
{
    [Description("AR_AT12")]

    public class Torsiometer_AR_AT12 : Torsiometer
    {
        public Torsiometer_AR_AT12(string strName) : base(strName)
        {
            controlFrom = new Form_Torsiometer_AR_AT12();
        }

        public override double Function_查询扭力(ref double 扭力)
        {
            byte[] byteSend = new byte[8];
            byteSend[0] = 0x01;
            byteSend[1] = 0x03;
            byteSend[2] = 0x00;
            byteSend[3] = 0x00;
            byteSend[4] = 0x00;
            byteSend[5] = 0x02;
            byteSend[6] = 0xC4;
            byteSend[7] = 0x0B;

            byte[] SendCommand_Recive = new byte[9];
            SendAndReciveData(byteSend,ref SendCommand_Recive,500);
            if (SendCommand_Recive[6] == 0)
                扭力 = SendCommand_Recive[3] * 256 + SendCommand_Recive[4];
            else
                扭力 = SendCommand_Recive[3] * 256 + SendCommand_Recive[4]-256-256*256;

            return 扭力/1000;
        }
    }
}
